﻿namespace dotnet_notes.Extensions
{
    /// <summary>
    /// 审核扩展类
    /// </summary>
    public static class ExamineExtension
    {
        /// <summary>
        /// 转换成审核历史列表
        /// </summary>
        public static List<ExamineHistoryDto> ToExamineHistoryList<T>(this List<T> list) where T : ExamineBase
        {
            var historyList = new List<ExamineHistoryDto>();

            foreach (var item in list)
            {
                var history = new ExamineHistoryDto
                {
                    SubmitTime = item.SubmitTime,
                    ExamineTime = item.ExamineTime,
                    ExamineType = item.ExamineType.GetDescription(),
                    ExamineStatus = item.ExamineStatus.GetDescription(),
                    ExamineRemark = item.ExamineRemark
                };

                historyList.Add(history);
            }

            return historyList;
        }
    }
}
